package com.dream.dream_ioc.beans.factory.support;

import com.dream.dream_ioc.beans.factory.BeanFactory;
import com.dream.dream_ioc.beans.factory.BeanFactoryUtils;

/**
 * BeanFactory 的抽象实现
 * @author wenpan
 */
public abstract class AbstractBeanFactory implements BeanFactory {
    @Override
    public Object getBean(String name) throws RuntimeException {
        return doGetBean(name, null, null, false);
    }

    @Override
    public <T> T getBean(String name, Class<T> requiredType) throws RuntimeException {
        return doGetBean(name, requiredType, null, false);
    }

    protected <T> T doGetBean(String name, Class<T> requiredType,
                              Object[] args, boolean typeCheckOnly) throws RuntimeException {
        String beanName = transformedBeanName(name);
        return null;
    }

    protected String transformedBeanName(String name) {
        return null;
        // return canonicalName(BeanFactoryUtils.transformedBeanName(name));
    }
}
